home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / UTILITY1 / IPXSPX.ZIP / IPXSPX.TXT < prev    next >
Text File  |  1993-12-20  |  9KB  |  327 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. IPX & SPX Custom Controls
  8. For
  9. Visual BasicTM 3.0
  10. &
  11. WindowsTM 3.1
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. Introduction
  39.  
  40. IPX (Internetwork Packet Exchange) protocol is a datagram (connectionless) service used 
  41. as the underlying protocol in Novell NetWare.  IPX establishes no connections nor 
  42. guarantee of delivery.  Each packet a workstation sends is treated separately.  SPX 
  43. (Sequenced Packet Exchange) is a connection-oriented protocol providing guaranteed 
  44. packet delivery, flow control, and sequencing.  SPX has many of the characteristics of the 
  45. transport level of OSI.  IPX/SPX are adaptations of protocols developed by Xerox(r), the 
  46. Xerox Network System, XNS(tm).
  47.  
  48. NetWare addressing is similar to the postal service's addressing system that identifies 
  49. recipients by country, state, city, street, number, apartment, and individual names.  
  50. NetWare addresses consist of three components:  network number, node address, and 
  51. socket.  Network numbers identify each segment of an internetwork.  Network numbers 
  52. are assigned when NetWare file servers and bridges are installed.  IPX derives the node 
  53. address from the address of each network adapter card.  Socket numbers provide routing 
  54. within a node, since several processes can be running simultaneously.  Processes can open 
  55. and close sockets to receive and send packets.
  56.  
  57. The IPX and SPX custom controls allow you to communicate with remote machines 
  58. connected by a local area network.  To use the control, you must have the workstations 
  59. set up as NetWare clients.  This involves loading IPX.COM or IPXODI.COM before 
  60. Windows loads.  The examples provided also require installing NETX or VLMs because 
  61. they use several NetWare services to find other users.
  62.  
  63. The IPX and SPX custom controls are event driven and relieve the application from 
  64. polling the status of network communication channels.  When new data is received from a 
  65. remote machine, the IPX or SPX custom control fires a Visual Basic subroutine allowing 
  66. the application to service the received information.
  67.  
  68. Several examples are provided showing how to use the controls.  Further information 
  69. about IPX and SPX can be found in the following references:  Client SDK Documentation 
  70. and C Programmer's Guide by Novell, C Programmer's Guide To NetBIOS, IPX And 
  71. SPX by W. David Schwaderer, Programmer's Guide to NetWare by Charles Rose, and 
  72. Network Programming in C, by Barry Nance.
  73.  
  74. Control Properties
  75.  
  76. (These properties apply to both controols, unless indicated otherwise)
  77.  
  78. Socket
  79. [form.]Control.Socket[ = numericexpression]
  80.  
  81. Sets the socket that the control listens to and sends packets out through.
  82.  
  83. Example:  spx1.Socket = &H5454
  84.  
  85. ReceiveECBS
  86. [form.]Control.ReceiveECBS[ = numericexpression]
  87.  
  88. Settings
  89. Default = 5 
  90.  
  91. Sets the number of ECBs that are used to receive packets.  Currently, this property should 
  92. only be set in the design environment and not at run time.   
  93.  
  94. SendECBS
  95. [form.]Control.SendECBS[ = numericexpression]
  96.  
  97. Settings
  98. Default = 1
  99.  
  100. Sets the number of ECBs that are used to send packets.  Currently, this property should 
  101. only be set in the design environment and not at run time.  In addition, this property 
  102. should currently be set to 1.
  103.  
  104. Channels
  105. [form]Control.Channels[ = numericexpression]
  106. (not applicable for IPX)
  107.  
  108. Settings
  109. Default = 1
  110.  
  111. Sets the maximum number of connections that the control will need to service. This 
  112. property can be set once after the control is loaded and cannot change until the control is 
  113. reloaded.  Currently, this property has no effect.
  114.  
  115. Example:  spx1.Channels = 1
  116.  
  117. Connection
  118. [form]Control.Connection
  119. (not applicable for IPX)
  120.  
  121. Returns the SPX connection ID assigned to this connection by SPX.  This ID may be used 
  122. to make SPX calls in NWIPXSPX.DLL.
  123.  
  124. Example:  id% = spx1.Connection
  125.  
  126. Send
  127. [form.]Control.Send[ = stringexpression]
  128.  
  129. Sends stringexpression to a remote node specified by RemoteName.
  130.  
  131. Example:  spx1.Send="HELLO WORLD"
  132.  
  133. Received
  134. [form.]Control.Received
  135.  
  136. Return Data Type     String
  137.  
  138. Retrieves data retrieved from the network.  When data is received, the control will call the 
  139. Visual Basic subroutine spx1_ReceiveData 
  140.  
  141. Example: 
  142. Sub spx1_ReceiveData ()
  143.     Data$ = spx1.Received
  144. End Sub
  145.  
  146. ReceivedFrom
  147. [form.]Control.ReceivedFrom 
  148.  
  149. Return Data Type    String * 12
  150.  
  151. Returns the internet address (network, node, and socket) of the node that sent the most 
  152. recently received packet.  
  153.  
  154. Example:  
  155. Sub spx1_ReceiveData()
  156.     From$ = spx1.ReceivedFrom
  157.             Data$ = spx1.Received 
  158.  End Sub
  159.  
  160. Event
  161. [form.]Control.Event
  162.  
  163. Return Data Type    Integer
  164.  
  165. Retrieves an event about the connection.  An event is any activity (received data, errors, 
  166. new connection with a remote, lost connection with a remote, etc.) related to the 
  167. connection.  When an event occurs, the control will fire the subroutine spx1_LinkEvent.  
  168.  
  169. Example:  
  170. Sub spx1_LinkEvent ()
  171.     Event% = spx1.Event
  172. End Sub
  173.  
  174. Status
  175. [form.]Control.Status [ = { 0}]
  176. (not applicable for IPX)
  177.  
  178. Status Initialization:
  179. 0     Disable
  180.  
  181. Status Information:
  182. 1     Control is listening for a connection
  183. 2     Control is trying to establish a connection
  184. 3     Control has established a connection, ready to send
  185. 4     Control is terminating the connection
  186.  
  187. Controls a connection and will contain status information.  Setting the Status property to 
  188. 0 will terminate any connection.
  189.  
  190. Example:  spx1.Status = 0     'Terminate any connection 
  191.  
  192. LinkType
  193. [form.]Control.LinkType [ = numericexpression]
  194. (not applicable for IPX)
  195.  
  196. Settings
  197. Default                    1
  198. 1                             establish a session with remote
  199. 2                             listen for connection
  200.  
  201. Set the control's mode of operation.  This may be changed at any time.
  202. Example:  spx1.LinkType = 2
  203.  
  204. LocalName
  205. [form.]Control.LocalName
  206.  
  207. Return Data Type    String * 12
  208.  
  209. Returns the internet address of the current workstation (network, node, and socket).
  210.  
  211. Example:  myAddress = spx1.LocalName
  212.  
  213. RemoteName
  214. [form.]Control.RemoteName[ = string expression]
  215.  
  216. Set the internet address that the control will use to send and receive data.  This may be 
  217. changed at any time.
  218.  
  219. Example:  spx1.RemoteName = yourAddress
  220.  
  221.  
  222.  
  223.  
  224. Control Events
  225.  
  226. LinkEvent()
  227.  
  228. This event is called each time an event for a connection occurs.  An event might be an 
  229. IPX/SPX error or an event listed in the event table.  The application should check the 
  230. value of the Event property during this event.
  231.  
  232. Example:
  233. Sub spx1_LinkEvent()
  234.     Event% = spx1.Event()
  235. End Sub
  236.  
  237. ReceiveData()
  238.  
  239. This event is called each time data is received.  The application should retrieve the value of 
  240. Received during this event.
  241.  
  242. Example:
  243. Sub spx1_ReceiveData()
  244.     Data$ = spx1.Received()
  245.  End Sub
  246.  
  247. SentData()
  248.  
  249. This event is called each time the control has transmitted data.  
  250.  
  251. Example:
  252. Sub spx1_SentData()
  253.      ' Ready to send next packet
  254.  End Sub
  255.  
  256.  
  257.  
  258.  
  259. Example Applications
  260.  
  261. NETCHAT.MAK
  262.  
  263. This example application uses the IPX control to send IPX packets to another workstation 
  264. and allow the users to chat to one another.  The application uses a simple protocol and 
  265. finite state machine to connect to another application, send and receive data, and then 
  266. disconnect from the other application.  This application also uses several calls provided by 
  267. NWCALLS.DLL to find all the other users and their internet addresses.
  268.  
  269. CLIENT.MAK & SERVER.MAK
  270.  
  271. These two examples demonstrate the SPX control in a simple client/server protocol.  The 
  272. client application sends a directory command to the server, which returns a directory  
  273. listing of the server's current directory.  To set an application, all that is needed is to set 
  274. the LinkType property to 2. To be a client, set the LinkType property to 1.
  275.  
  276. Event Values
  277.  
  278. Any of the following events will trigger a spx1_LinkEvent call.  The value returned by 
  279. Event is listed in the left column and its meaning is listed on the right.
  280.  
  281. 237            Abnormal Connection Termination
  282.  
  283. 238            Invalid Connection
  284.  
  285. 239            Connection Table Full
  286.  
  287. 2